package com.example.appathon13;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class BrowseSpaceListAdapter extends BaseAdapter {
	private static ArrayList<String> searchArrayList;

	private LayoutInflater mInflater;

	public BrowseSpaceListAdapter(Context context, ArrayList<String> results) {
		searchArrayList = results;
		mInflater = LayoutInflater.from(context);
	}

	public int getCount() {
		return searchArrayList.size();
	}

	public Object getItem(int position) {
		return searchArrayList.get(position);
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.browsespace_row_view, null);
			holder = new ViewHolder();
			holder.txtName = (TextView) convertView.findViewById(R.id.name);
			holder.txtTimeAvailable = (TextView) convertView.findViewById(R.id.time_available);
			holder.txtDate = (TextView) convertView.findViewById(R.id.date);


			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}

		holder.txtName.setText(" ");
		holder.txtTimeAvailable.setText(" ");
		holder.txtDate.setText(" ");


		return convertView;
	}

	static class ViewHolder {
		TextView txtName;
		TextView txtTimeAvailable;
		TextView txtDate;

	}
}